set -e

if [[ ! -f $1/Dockerfile ]]; then 
    echo "There is no Dockerfile existed in $1."
    exit 0
fi

NAME="core"
if [[ $NAME != "." ]]; then
    NAME=${1//\//_}
    NAME=${NAME/%_/}
fi

docker build -f $1/Dockerfile -t swr.cn-north-4.myhuaweicloud.com/sang/$NAME:$2 .